<template>
  <div class="dashboard-container">
    <el-row :gutter="20">
      <el-col :span="17" class="letf_col">
        <el-card class="box-card1 top_card">
          <template #header>
            <div class="card-header">
              <span class="head_title">常用功能</span>
              <p @click="handleCustomDia" class="custom_p">自定义 ></p>
            </div>
          </template>
          <div class="use_">
            <div v-for="(v1, k1) in routesUi" :key="k1" class="use_item">
              <div class="icon">
                <img :src="v1.icon" class="icon-img" @click="goToPath(v1.path)" />
                <p @click="goToPath(v1.path)">{{ v1.name }}</p>
              </div>
            </div>
          </div>
          <img src="~@/assets/reset/03.png" class="left_img" />
          <img src="~@/assets/reset/02.png" class="right_img" />
        </el-card>

        <el-card class="box-card2">
          <template #header>
            <div class="card-header">
              <span class="head_title">我的任务</span>
              <div class="renwu">
                <div class="renwu_left" :class="taskInfo.cur == 0 ? 'btn_active' : ''" @click="clickRenWu(0)">
                  待办({{ taskInfo.untreated.pageTotal }})
                </div>
                <div class="renwu_right" :class="taskInfo.cur == 1 ? 'btn_active' : ''" @click="clickRenWu(1)">
                  已办
                </div>
              </div>
            </div>
          </template>
          <div>
            <div v-if="taskInfo.cur == 0">
              <el-table :data="taskInfo.untreated.data" style="width: 100%" height="280" :header-cell-style="{
                  background: 'rgba(11, 132, 123, 0.08)',
                  color: '#000',
                }">
                <el-table-column label="审批状态" align="center" width="100px">
                  <template slot-scope="scope">
                    <b>
                      <el-tag v-if="scope.row.sta == 3" type="info">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                      <el-tag v-if="scope.row.sta == 1" type="success">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                      <el-tag v-if="scope.row.sta == 0" type="warning">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                      <el-tag v-if="scope.row.sta == 2" type="danger">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                    </b>
                  </template>
                </el-table-column>
                <el-table-column label="业务类型" align="center" width="100px">
                  <template slot-scope="scope">
                    <b>
                      <el-tag>{{ getTypeStr(scope.row.typ) }}</el-tag>
                    </b>
                  </template>
                </el-table-column>
                <el-table-column label="申请时间" align="center" width="110px">
                  <template slot-scope="scope">{{
                    formatYearMonthDay(scope.row.createTime)
                    }}</template>
                </el-table-column>

                <el-table-column label="标题" align="center">
                  <template slot-scope="scope">{{ scope.row.title }}</template>
                </el-table-column>
                <el-table-column label="内容">
                  <template slot-scope="scope">
                    <!-- {{ scope.row.content }} -->
                    <div style="white-space: pre-wrap">
                      {{ formatContent(scope.row.content) }}
                    </div>
                  </template>
                </el-table-column>

                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button v-if="scope.row.sta == 0" size="mini" type="primary" plain
                      @click="showShenpiDialog(scope.$index, scope.row)">审批</el-button>
                    <el-button size="mini" type="primary" plain @click="
                        seeDetail(
                          scope.row.typ,
                          scope.row.relevenceId,
                          scope.row.id
                        )
                      ">查看详情</el-button>
                    <el-button v-if="
                        scope.row.sta == 0 &&
                        scope.row.typ == 18 &&
                        userInfo.uid == 4
                      " size="mini" type="primary" plain @click="revertGongwen(scope.row.relevenceId)">撤回</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <pagination :total="taskInfo.untreated.pageTotal" :page.sync="taskInfo.untreated.pageNum"
                :limit.sync="taskInfo.untreated.pageSize" @pagination="getTaskListUntreated" />
            </div>

            <div v-if="taskInfo.cur == 1">
              <el-table :data="taskInfo.completed.data" style="width: 100%" height="280" :header-cell-style="{
                  background: 'rgba(11, 132, 123, 0.08)',
                  color: '#000',
                }">
                <el-table-column label="审批状态" align="center" width="100px">
                  <template slot-scope="scope">
                    <b>
                      <el-tag v-if="scope.row.sta == 3" type="info">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                      <el-tag v-if="scope.row.sta == 1" type="success">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                      <el-tag v-if="scope.row.sta == 0" type="warning">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                      <el-tag v-if="scope.row.sta == 2" type="danger">{{
                        getTaskStaStr(scope.row.sta)
                        }}</el-tag>
                    </b>
                  </template>
                </el-table-column>
                <el-table-column label="业务类型" align="center" width="100px">
                  <template slot-scope="scope">
                    <b>
                      <el-tag>{{ getTypeStr(scope.row.typ) }}</el-tag>
                    </b>
                  </template>
                </el-table-column>
                <el-table-column label="申请时间" align="center" width="110px">
                  <template slot-scope="scope">{{
                    formatYearMonthDay(scope.row.createTime)
                    }}</template>
                </el-table-column>

                <el-table-column label="标题" align="center">
                  <template slot-scope="scope">{{ scope.row.title }}</template>
                </el-table-column>
                <el-table-column label="内容">
                  <template slot-scope="scope">
                    <!-- {{ scope.row.content }} -->
                    <div style="white-space: pre-wrap">
                      {{ formatContent(scope.row.content) }}
                    </div>
                  </template>
                </el-table-column>

                <el-table-column label="操作" align="center">
                  <template slot-scope="scope">
                    <el-button v-if="scope.row.sta == 0" size="mini" type="primary" plain
                      @click="showShenpiDialog(scope.$index, scope.row)">审批</el-button>
                    <el-button size="mini" type="primary" plain @click="
                        seeDetail(
                          scope.row.typ,
                          scope.row.relevenceId,
                          scope.row.id
                        )
                      ">查看详情</el-button>
                    <el-button v-if="
                        scope.row.sta == 0 &&
                        scope.row.typ == 18 &&
                        userInfo.uid == 4
                      " size="mini" type="primary" plain @click="revertGongwen(scope.row.relevenceId)">撤回</el-button>
                  </template>
                </el-table-column>
              </el-table>
              <pagination :total="taskInfo.completed.pageTotal" :page.sync="taskInfo.completed.pageNum"
                :limit.sync="taskInfo.completed.pageSize" @pagination="getTaskListCompleted" />
            </div>
          </div>
        </el-card>

        <el-card class="box-card3">
          <template #header>
            <div class="card-header">
              <span class="head_title">我的通知</span>
              <div class="renwu">
                <div class="renwu_left" :class="tongzhiActive == 0 ? 'btn_active' : ''" @click="clickTongZhi(0)">
                  未读({{ weiduNum }})
                </div>
                <div class="renwu_right" :class="tongzhiActive == 1 ? 'btn_active' : ''" @click="clickTongZhi(1)">
                  已读
                </div>
              </div>
            </div>
          </template>
          <div>
            <div class="tabs">
              <p v-for="(i, index) in tongzhiTabs" :key="index" @click="clickTabs(i, index, true)"
                :class="tabsIndex == index ? 'tabsActive' : ''">
                {{ i.name }}
                <el-badge v-if="i.count" :value="i.count"> </el-badge>
              </p>
            </div>

            <!-- 绩效管理 -->
            <my-task1 v-if="tabsIndex == 1" :tableData="myTaskData2" :total="myTas2Total" :listParams="listParams"
              @tongzhi-event="handleTongzhiEvent" @tongzhi-seeInfo="handleTongzhiSeeInfo" />
            <!-- 科研管理 -->
            <my-task2 v-if="tabsIndex == 2" :tableData="myTaskData2" :total="myTas2Total" :listParams="listParams"
              @tongzhi-event="handleTongzhiEvent" @tongzhi-seeInfo="handleTongzhiSeeInfo" />
            <!-- 党费收缴 -->
            <my-task3 v-if="tabsIndex == 3" :tableData="myTaskData2" :total="myTas2Total" :listParams="listParams"
              @tongzhi-event="handleTongzhiEvent" @tongzhi-seeInfo="handleTongzhiSeeInfo" />
            <!-- 理论测验 -->
            <my-task4 v-if="tabsIndex == 4" :tableData="myTaskData2" :total="myTas2Total" :listParams="listParams"
              @tongzhi-event="handleTongzhiEvent" @tongzhi-seeInfo="handleTongzhiSeeInfo" />
            <!-- 党群活动 -->
            <my-task5 v-if="tabsIndex == 5" :tableData="myTaskData2" :total="myTas2Total" :listParams="listParams"
              @tongzhi-event="handleTongzhiEvent" @tongzhi-seeInfo="handleTongzhiSeeInfo" />
            <!-- 项目管理 -->
            <my-task6 v-if="tabsIndex == 6" :tableData="myTaskData2" :total="myTas2Total" :listParams="listParams"
              @tongzhi-event="handleTongzhiEvent" @tongzhi-seeInfo="handleTongzhiSeeInfo" />
            <!-- 其它通知 -->
            <my-task7 v-if="tabsIndex == 0" :tableData="myTaskData2" :total="myTas2Total" :listParams="listParams"
              @tongzhi-event="handleTongzhiEvent" @tongzhi-seeInfo="handleTongzhiSeeInfo" />
          </div>
        </el-card>
      </el-col>
      <el-col :span="7" class="right_col">
        <el-card class="box-card">
          <template #header>
            <div class="card-header">
              <span class="head_title">我的日程</span>
            </div>
          </template>
          <div class="right_content">
            <a-calendar v-model="selectedDate" :fullscreen="false" :locale="locale" @change="onChange"
              class="right_item1"></a-calendar>
            <schedule class="right_item" :scheduleData="scheduleArr[0]" />
            <schedule class="right_item" :scheduleData="scheduleArr[1]" />
            <img src="~@/assets/reset/02.png" class="right_img_col" />
          </div>
        </el-card>
      </el-col>
    </el-row>
    <el-dialog title="自定义常用功能" :visible.sync="customDia" width="50%" :before-close="handleClose" class="gong_dialog">
      <div class="changyong">
        <div class="changyong_title">常用功能</div>
        <div class="changyong_div">
          <div v-for="(v2, k2) in saveRoute" :key="k2" class="changyong_item">
            <div>
              <img :src="v2.icon" class="" />
              <span style="padding-left: 3px">{{ v2.name }}</span>
            </div>
            <img src="~@/assets/reset/del.png" class="del_img" @click="subRoute(k2)" />
          </div>
        </div>
      </div>
      <hr style="background-color: #e4e4e4; height: 1px; border: none" />
      <div class="choose_item">
        <div v-for="(v1, k1) in allRoutes" :key="k1" style="margin-bottom: 10px">
          <div class="v1_item">
            <div style="font-size: 20px; font-weight: bold">
              <p class="v1_name">{{ v1.name }}</p>
            </div>
            <div class="v2_div">
              <div v-for="(v2, k2) in v1.routes" :key="k2" class="div_icon">
                <div>
                  <img :src="v2.icon" />
                  <span style="padding-left: 3px">{{ v2.name }}</span>
                </div>
                <img src="~@/assets/reset/add.png" class="del_img" @click="addRoute(v2)" />
              </div>
            </div>
          </div>
        </div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="customDia = false">取 消</el-button>
        <el-button type="primary" @click="addMenuFun">确 定</el-button>
      </span>
    </el-dialog>
    <info-dia :tongInfo="tongInfo" :seeInfoDia="seeInfoDiaV" @tongzhi-close="handleTongzhiInfoClose"
      :tabsIndex="tabsIndex" />

    <el-dialog title width="60%" :visible.sync="detailDialog.visible" top="5vh" :close-on-click-modal="false" :close-on-press-escape="false" :show-close="false">
      <qingjia-detail v-if="detailDialog.visible0" :id="detailDialog.id0" />
      <chuchai-detail v-if="detailDialog.visible1" :id="detailDialog.id1" />
      <jiaban-detail v-if="detailDialog.visible2" :id="detailDialog.id2" />
      <ruzhi-detail v-if="detailDialog.visible3" :id="detailDialog.id3" />
      <zhuanzheng-detail v-if="detailDialog.visible4" :id="detailDialog.id4" />
      <lizhi-detail v-if="detailDialog.visible5" :id="detailDialog.id5" />
      <dubandan-detail v-if="detailDialog.visible6" :id="detailDialog.id6" />
      <huiyishi-detail v-if="detailDialog.visible7" :id="detailDialog.id7" />
      <jiedaidan-detail v-if="detailDialog.visible8" :id="detailDialog.id8" />
      <jiayou-detail v-if="detailDialog.visible9" :id="detailDialog.id9" />
      <yongche-detail v-if="detailDialog.visible10" :id="detailDialog.id10" />
      <yongyin-detail v-if="detailDialog.visible11" :id="detailDialog.id11" />
      <caigou-detail v-if="detailDialog.visible13" :id="detailDialog.id13" />
      <wuzilingyong-detail v-if="detailDialog.visible14" :id="detailDialog.id14" />
      <hetongshenpi-detail v-if="detailDialog.visible15" :id="detailDialog.id15" />
      <zhaobiaoshenhe-detail v-if="detailDialog.visible16" :id="detailDialog.id16" />
      <chuanyuewenjian-detail v-if="detailDialog.visible17" :id="detailDialog.id17" />
      <gongwenliuzhuan-detail v-if="detailDialog.visible18" :id="detailDialog.id18" :isYue="isYue" />
      <buka-detail v-if="detailDialog.visible19" :id="detailDialog.id19" />
      <huiyitongzhi-detail v-if="detailDialog.visible20" :id="detailDialog.id20" />
      <gongzuotongzhi-detail v-if="detailDialog.visible21" :id="detailDialog.id21" />
      <paiban-detail v-if="detailDialog.visible22" :id="detailDialog.id22" />
      <neibufawen-detail v-if="detailDialog.visible23" :id="detailDialog.id23" />
      <xianjianfawen-detail v-if="detailDialog.visible24" :id="detailDialog.id24" />
      <xuanchuanbaodao-detail v-if="detailDialog.visible25" :id="detailDialog.id25" />
      <gongzuocan-detail v-if="detailDialog.visible26" :id="detailDialog.id26" />

      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="closeDia">确 定</el-button>
      </div>
    </el-dialog>

    <el-dialog title="审批" width="40%" :visible.sync="shenpiDialog.visible">
      <el-form style="margin: 15px">
        <el-form-item v-if="shenpiDialog.departVisible" label="承办部门">
          <el-checkbox-group v-model="shenpiDialog.selectedDeparts" placeholder="请选择" style="width: 100%">
            <el-checkbox v-for="(yz, idx) in departmentList" :key="idx" :label="idx">{{ yz.name }}</el-checkbox>
          </el-checkbox-group>
        </el-form-item>
        <el-form-item label="车牌" v-if="shenpiDialog.showSelectChepai">
          <el-select v-model="shenpiDialog.chepai" placeholder="请选择">
            <el-option v-for="item in chepaiList" :key="item.value" :label="item.label" :value="item.value"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item v-if="shenpiDialog.manyUserVisible" :label="shenpiDialog.manyUserLabel">
          <el-cascader v-model="shenpiDialog.manyUser" :options="userList" :props="props" filterable clearable
            style="width: 100%" />
        </el-form-item>
        <el-form-item v-if="shenpiDialog.oneUserVisible" :label="shenpiDialog.oneUserLabel">
          <el-cascader v-model="shenpiDialog.oneUser" :options="userList" clearable style="width: 100%" />
        </el-form-item>
        <div v-if="userInfo.name=='陈皓玉' &&liuchengType == 18"></div>
        <div v-else>
          <el-form-item v-if="shenpiDialog.msgVisible" label="审批信息">
            <el-input v-model="shenpiDialog.msg" type="textarea" />
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="rejectTask">拒 绝</el-button>
        <el-button type="primary" @click="clickAgreeBtn">{{
          shenpiDialog.agreeBtnStr
          }}</el-button>
      </div>
    </el-dialog>

    <!-- 新建公文审批 -->
    <el-dialog title="新建发文审批" width="40%" :visible.sync="xinjainfawenShow">
      <el-form style="margin: 15px">
        <el-form-item v-if="
            xuanzeSHOW == '部门负责人' &&
            xuanzeSHOW2 == '分管领导' &&
            xuanzeSHOW3 == loginId
          " label="姓名" prop="userId">
          <el-cascader style="width: 100%" v-model="userId" :show-all-levels="false" :options="cascaderData"
            :props="cascaderProps" @change="handleChangeCascader" />
        </el-form-item>
        <el-form-item label="审批信息">
          <el-input v-model="msg" type="textarea" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="rejectTask1(1)">拒 绝</el-button>
        <el-button type="primary" @click="clickAgreeBtn1(1)">{{
          shenpiDialog.agreeBtnStr1
          }}</el-button>
        <el-button type="danger" @click="clickAgreeBtn2(1)">{{
          shenpiDialog.agreeBtnStr2
          }}</el-button>
      </div>
    </el-dialog>
    <!-- 宣传报道审批 -->
    <el-dialog title="宣传报道审批" width="40%" :visible.sync="xuanchuanbaodaoShow">
      <el-form style="margin: 15px">
        <el-form-item v-if="
            xuanzeSHOW == '宣教科负责人' &&
            xuanzeSHOW2 == '1' &&
            xuanzeSHOW3 == loginId
          " label="姓名" prop="userId">
          <el-cascader style="width: 100%" v-model="userId" :show-all-levels="false" :options="cascaderData"
            :props="cascaderProps" @change="handleChangeCascader" />
        </el-form-item>
        <el-form-item label="审批信息">
          <el-input v-model="msg" type="textarea" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="rejectTask1(2)" v-if="isChengban == 1 ? false : true">拒 绝</el-button>
        <el-button type="primary" @click="clickAgreeBtn1(2)" v-if="isChengban == 1 ? false : true">{{
          shenpiDialog.agreeBtnStr1 }}</el-button>
        <el-button type="primary" @click="clickAgreeBtn1(3)" v-if="isChengban == 1 ? true : false">已完成</el-button>
        <el-button type="danger" @click="clickAgreeBtn2(2)" v-if="isChengban == 1 ? false : true">{{
          shenpiDialog.agreeBtnStr2 }}</el-button>
      </div>
    </el-dialog>
    <!-- 工作餐审批 -->
    <el-dialog title="工作餐申请审批" width="40%" :visible.sync="gongzuocanShow">
      <el-form>
        <el-form-item label="审批信息">
          <el-input v-model="msg" type="textarea" />
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="rejectTask1(4)">拒 绝</el-button>
        <el-button type="primary" @click="clickAgreeBtn1(4)">{{
          shenpiDialog.agreeBtnStr1
          }}</el-button>
        <el-button type="danger" @click="clickAgreeBtn2(4)">{{
          shenpiDialog.agreeBtnStr2
          }}</el-button>
      </div>
    </el-dialog>

    <!-- 公文流转修改 -- 2024-03-05 -->
    <el-dialog title="审批" width="40%" :visible="step > 2" @close="closeStep">
      <el-form style="margin: 15px">
        <!-- 第三步，行政助理：陈皓玉选择分管领导 -->
        <el-form-item label="选择分管领导" v-if="step == 3">
          <el-cascader v-model="shenpiDialog.manyUser" :options="userList" :props="props" filterable clearable
            style="width: 100%" />
        </el-form-item>

        <!-- 第四步，分管领导：副主任批示 -->
        <!-- {{ step >= 4 && isFenGuan() }} -->
        <el-form-item label="审批信息" v-if="step >= 4 && isFenGuan()">
          <el-input v-model="shenpiDialog.msg" type="textarea" />
        </el-form-item>

        <!-- 第五步，行政助理：陈皓玉选择承办部门 -->
        <el-form-item label="承办部门" v-if="step >= 4 && userInfo.positionName ==='行政助理'">
          <el-checkbox-group v-model="shenpiDialog.selectedDeparts" placeholder="请选择" style="width: 100%">
            <el-checkbox v-for="(yz, idx) in departmentList" :key="idx" :label="idx">{{ yz.name }}</el-checkbox>
          </el-checkbox-group>
        </el-form-item>

        <div v-if="step >= 4 && isChenBanLeaderFun()">
          <el-form-item label="选择经办人">
            <el-cascader v-model="shenpiDialog.oneUser" :options="handleUser" clearable style="width: 100%" :props="handleUserProps" />
          </el-form-item>
          <el-form-item label="审批信息">
            <el-input v-model="shenpiDialog.msg" type="textarea" />
          </el-form-item>
        </div>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="endProcess" v-if="step == 3">结束流程</el-button>
        <el-button @click="rejectTask">拒 绝</el-button>
        <el-button type="primary" @click="clickAgreeBtn">{{
          shenpiDialog.agreeBtnStr
          }}</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import QingjiaDetail from "../../components/details/qingjiaDetail.vue";
import ChuchaiDetail from "../../components/details/chuchaiDetail.vue";
import JiabanDetail from "../../components/details/jiabanDetail.vue";
import RuzhiDetail from "../../components/details/ruzhiDetail.vue";
import ZhuanzhengDetail from "../../components/details/zhuanzhengDetail.vue";
import LizhiDetail from "../../components/details/lizhiDetail.vue";
import DubandanDetail from "../../components/details/dubandanDetail.vue";
import HuiyishiDetail from "../../components/details/huiyishiDetail.vue";
import JiedaidanDetail from "../../components/details/jiedaidanDetail.vue";
import JiayouDetail from "../../components/details/jiayouDetail.vue";
import YongcheDetail from "../../components/details/yongcheDetail.vue";
import YongyinDetail from "../../components/details/yongyinDetail.vue";
import CaigouDetail from "../../components/details/caigouDetail.vue";
import WuzilingyongDetail from "../../components/details/wuzilingyongDetail.vue";
import HetongshenpiDetail from "../../components/details/hetongshenpiDetail.vue";
import ZhaobiaoshenheDetail from "../../components/details/zhaobiaoshenheDetail.vue";
import ChuanyuewenjianDetail from "../../components/details/chuanyuewenjianDetail.vue";
import GongwenliuzhuanDetail from "../../components/details/gongwenliuzhuanDetail.vue";
import BukaDetail from "../../components/details/bukaDetail.vue";
import HuiyitongzhiDetail from "../../components/details/huiyitongzhiDetail.vue";
import GongzuotongzhiDetail from "../../components/details/gongzuotongzhiDetail.vue";
import PaibanDetail from "../../components/details/paibanDetail.vue";
import NeibufawenDetail from "../../components/details/neibufawenDetail.vue";
import XianjianfawenDetail from "../../components/details/xianjianfawenDetail.vue";
import xuanchuanbaodaoDetail from "../../components/details/xuanchuanbaodaoDetail.vue";
import gongzuocanDetail from "../../components/details/gongzuocanDetail.vue";

import { websock } from "@/websock";
import {
  getXinjian,
  getUserList,
  shenpiXinjian,
  getxuanchuan,
  shenpixuanchuan,
  getgongzuocan,
  shenpigongzuocan,
} from "@/api2/xinjianfawen";
import moment from "moment";
import event from "../../event";
import {
  commonMenuApi,
  commonMenuAddApi,
  commonNumApi,
  commonInfoApi,
  getDailyTaskApi,
  changeStatusApi,
  tongSeeinfoApi, // 查看详情
  activityPlaceListApi,
} from "@/api2/reset";

import MyTasks1 from "./components/tongzhi/MyTasks1.vue";
import MyTasks2 from "./components/tongzhi/MyTasks2.vue";
import MyTasks3 from "./components/tongzhi/MyTasks3.vue";
import MyTasks4 from "./components/tongzhi/MyTasks4.vue";
import MyTasks5 from "./components/tongzhi/MyTasks5.vue";
import MyTasks6 from "./components/tongzhi/MyTasks6.vue";
import MyTasks7 from "./components/tongzhi/MyTasks7.vue";
import InfoDia from "./components/tongzhi/infoDia.vue";

import schedule from "./components/schedule.vue";

import { Calendar } from "ant-design-vue";
import "moment/locale/zh-cn";

export default {
  name: "Dashboard",
  components: {
    "a-calendar": Calendar,
    MyTask1: MyTasks1,
    MyTask2: MyTasks2,
    MyTask3: MyTasks3,
    MyTask4: MyTasks4,
    MyTask5: MyTasks5,
    MyTask6: MyTasks6,
    MyTask7: MyTasks7,
    InfoDia: InfoDia,
    schedule: schedule,
    QingjiaDetail,
    ChuchaiDetail,
    JiabanDetail,
    RuzhiDetail,
    ZhuanzhengDetail,
    LizhiDetail,
    DubandanDetail,
    HuiyishiDetail,
    JiedaidanDetail,
    JiayouDetail,
    YongcheDetail,
    YongyinDetail,
    CaigouDetail,
    WuzilingyongDetail,
    HetongshenpiDetail,
    ZhaobiaoshenheDetail,
    ChuanyuewenjianDetail,
    GongwenliuzhuanDetail,
    BukaDetail,
    HuiyitongzhiDetail,
    GongzuotongzhiDetail,
    XianjianfawenDetail,
    xuanchuanbaodaoDetail,
    PaibanDetail,
    NeibufawenDetail,
    gongzuocanDetail,
  },
  async created() {
    const userRoutes = JSON.parse(sessionStorage.getItem("userRoutes"));
    this.userRoutes = [...userRoutes];

    this.userInfo = await websock.getUserInfo();

    const res = await websock.getContactList();
    const userList = [];
    for (let i = 0; i !== res.length; i++) {
      userList.push({
        value: i + "",
        label: res[i].name,
        children: [],
      });
      for (let j = 0; j !== res[i].userList.length; j++) {
        userList[i].children.push({
          value: JSON.stringify({
            uid: res[i].userList[j].uid,
            name: res[i].userList[j].name,
            positionName: res[i].userList[j].positionName,
          }),
          label: res[i].userList[j].name,
        });
      }
    }
    this.userList = userList;
    console.log(this.userList,'this.userList')

    // 获取公文流转中的具体经办人的部门数据
    const loginUserInfo = JSON.parse(sessionStorage.getItem('loginUserinfo'));
    const loginDept = loginUserInfo.departmentName;
    const user = this.userList.find(user => user.label.includes(loginDept));

    if (user) {
      this.handleUser = user.children ? user.children : [];
    }

    this.getUserList();
    this.departmentList = await websock.getDepartList();
    this.departmentList = this.departmentList.slice(1);
    this.taskInfo1 = await getUserList();
    const chepaiList = await websock.chepaiList();
    for (let i = 0; i != chepaiList.length; i++) {
      this.chepaiList.push({
        value: chepaiList[i].name,
        label: chepaiList[i].name,
      });
    }

    this.timer = setInterval(() => {
      this.updateTime();
    }, 200);

    this.getTaskRedPoint();
    this.getNoticeRedPoint();
    this.gerCommonNumApi(0);
    this.getTime();

    event.on("TASK-NEW", this.getTaskRedPoint);
    event.on("TASK-CHANGE", this.getTaskRedPoint);

    event.on("NOTIFICATION-NEW", this.getNoticeRedPoint);
    event.on("NOTIFICATION-CHANGE", this.getNoticeRedPoint);

    this.getCommonMenu();

    this.getTaskList();
    this.getxingZheng();
  },
  destroyed() {
    event.off("TASK-NEW", this.getTaskRedPoint);
    event.off("TASK-CHANGE", this.getTaskRedPoint);

    event.off("NOTIFICATION-NEW", this.getNoticeRedPoint);
    event.off("NOTIFICATION-CHANGE", this.getNoticeRedPoint);
  },
  data() {
    return {
      isYue: false, // 判断是否阅办
      relevenceId:'', // 流程的id
      auditorsArr:[],
      chengbanrenArr:[],
      handleUserProps: {
        multiple: true
      },
      handleUser: [], // 经办人
      step: 0, // 公文流转已经到哪一步了
      liuchengType: 0, // 判断是否是公文流转
      normalFeatures: ["qingjia", "chuchai"], // 默认常用功能
      xuanzeSHOW: "",
      xuanzeSHOW2: "",
      xuanzeSHOW3: "",
      cascaderProps: {
        emitPath: false,
      },
      loginId: JSON.parse(sessionStorage.getItem("loginUserinfo")).uid,
      cascaderData: [],
      isChengban: "",
      idd: "",
      msg: "",
      stas: false,
      xuanzeID: "",
      taskIdd: "",
      approvalProcessDataBeanMaps: [],
      props: { multiple: true },
      userInfo: {},
      userList: [],
      departmentList: [],
      chepaiList: [],
      xinjainfawenShow: false,
      xuanchuanbaodaoShow: false,
      gongzuocanShow: false,
      // 任务信息
      taskInfo: {
        // 当前显示 0待办 1已办
        cur: 0,
        // 待办
        untreated: {
          pageNum: 0,
          pageSize: 0,
          pageTotal: 0,
          data: [],
        },
        // 已办
        completed: {
          pageNum: 0,
          pageSize: 0,
          pageTotal: 0,
          data: [],
        },
      },
      // 查看通知详情
      seeInfoDiaV: false,
      tongInfo: {},
      listParams: {
        pageNum: 1,
        pageSize: 10,
      },
      tabsIndex: 0,
      tongzhiTabs: [],
      locale: {
        lang: {
          month: "月",
          year: "年",
        },
      },
      weiduNum: 11,
      // 日程数据
      scheduleArr: [],
      selectedDate: "",
      myTaskData1: [],
      myTaskData2: [],
      myTas2Total: 0,
      calendarValue: "",
      tabPosition: "left",
      saveRoute: [], // 保存已选数据
      allRoutes: [], // 个人所有菜单
      customDia: false,
      // 默认功能
      routesUi: [],
      waitNum: 0,
      // ---------------------
      temperature: 0, // 温度
      humidity: 0, // 湿度
      timer: null,
      dateStr: "",
      timeStr: "",
      weekStr: "",
      keyword: "",
      taskRedPoint: "",
      noticeRedPoint: "",
      // 界面配置
      uiCfg: [
        {
          name: "通知",
          routes: ["huiyi", "gongzuo", "xinxiang"],
        },
        {
          name: "物资",
          routes: ["caigoushenqing", "wuzilingyong"],
        },
        {
          name: "假勤",
          routes: ["qingjia", "chuchai", "jiaban"],
        },
        {
          name: "人事",
          routes: [
            "userManage",
            "gongzi",
            "ruzhiApply",
            "zhuanzhengApply",
            "lizhiApply",
          ],
        },
        {
          name: "行政",
          routes: [
            "duban",
            "jiaripaiban",
            "yongyin",
            "yongche",
            "jiayou",
            "huiyishi",
            "jiedaidan",
          ],
        },
        {
          name: "法务",
          routes: ["hetong", "zhaobiaowenjian"],
        },
        {
          name: "公文",
          routes: [
            "gongwenchuanyue",
            "gongwenliuzhuan",
            "neibufawen",
            "xinjianfawen",
            "xuanchuanbaodao",
          ],
        },
        {
          name: "系统",
          routes: [
            "positionCon",
            "roleCon",
            "userGroup",
            "departmentCon",
            "jiejiariCon",
            "cheliangCon",
            "huiyishiCon",
            "qingjiaCon",
            "yinzhangCon",
            "eveCon",
            "rootCon",
          ],
        },
        {
          name: "绩效管理",
          routes: [
            "createTemplate",
            "assessment",
            "filling",
            "estimate",
            "dataScreening",
            "Notification",
            "management",
            "announcement",
          ],
        },
        {
          name: "党建",
          routes: [
            "dangzuzhi",
            "partyRole",
            "partyUser",
            "partyDues",
            "questionBank",
            "examPaper",
            "marking",
            "education",
            "activityLedger",
            "mailbox",
          ],
        },
        {
          name: "项目管理",
          routes: [
            "openReport",
            "approvalInitiateDeclaration",
            "approveReport",
            "processProjectList",
            "processDataManagement",
            "processDataStatistics",
            "projectLibrary",
            "projectForum",
          ],
        },
        {
          name: "科研管理",
          routes: [
            "ScientificData",
            "ScientificPeople",
            "ScientificFunding",
            "release",
            "Filling",
            "approve",
          ],
        },
      ],
      // 路由配置
      routesCfg: {
        dashboard: {
          name: "我的",
          path: "/views/dashboard/index",
          icon: require("../../assets/work/1.png"),
        },
        huiyi: {
          name: "会议通知",
          path: "/tongzhi/huiyi",
          icon: require("../../assets/work/1.png"),
        },
        gongzuo: {
          name: "工作通知",
          path: "/tongzhi/gongzuo",
          icon: require("../../assets/work/7.png"),
        },
        xinxiang: {
          name: "信箱通知",
          path: "/tongzhi/xinxiang",
          icon: require("../../assets/work/sjxx.png"),
        },
        caigoushenqing: {
          name: "采购申请",
          path: "/wuziManage/caigoushenqing",
          icon: require("../../assets/work/2.png"),
        },
        wuzilingyong: {
          name: "物资领用",
          path: "/wuziManage/wuzilingyong",
          icon: require("../../assets/work/3.png"),
        },
        qingjia: {
          name: "请假申请",
          path: "/jiaqingManage/qingjia",
          icon: require("../../assets/work/4.png"),
        },
        chuchai: {
          name: "出差申请",
          path: "/jiaqingManage/chuchai",
          icon: require("../../assets/work/5.png"),
        },
        jiaban: {
          name: "加班申请",
          path: "/jiaqingManage/jiaban",
          icon: require("../../assets/work/6.png"),
        },
        userManage: {
          name: "员工管理",
          path: "/renshiManage/userManage",
          icon: require("../../assets/work/9.png"),
        },
        gongzi: {
          name: "工资管理",
          path: "/renshiManage/gongzi",
          icon: require("../../assets/work/11.png"),
        },
        ruzhiApply: {
          name: "入职申请",
          path: "/renshiManage/ruzhiApply",
          icon: require("../../assets/work/8.png"),
        },
        zhuanzhengApply: {
          name: "转正申请",
          path: "/renshiManage/zhuanzhengApply",
          icon: require("../../assets/work/9.png"),
        },
        lizhiApply: {
          name: "离职申请",
          path: "/renshiManage/lizhiApply",
          icon: require("../../assets/work/10.png"),
        },
        duban: {
          name: "督办",
          path: "/xingzhengManage/duban",
          icon: require("../../assets/work/12.png"),
        },
        jiaripaiban: {
          name: "假日排班",
          path: "/xingzhengManage/jiaripaiban",
          icon: require("../../assets/work/13.png"),
        },
        yongyin: {
          name: "用印申请",
          path: "/xingzhengManage/yongyin",
          icon: require("../../assets/work/14.png"),
        },
        yongche: {
          name: "用车申请",
          path: "/xingzhengManage/yongche",
          icon: require("../../assets/work/15.png"),
        },
        jiayou: {
          name: "加油申请",
          path: "/xingzhengManage/jiayou",
          icon: require("../../assets/work/16.png"),
        },
        huiyishi: {
          name: "会议室申请",
          path: "/xingzhengManage/huiyishi",
          icon: require("../../assets/work/17.png"),
        },
        jiedaidan: {
          name: "接待单",
          path: "/xingzhengManage/jiedaidan",
          icon: require("../../assets/work/18.png"),
        },
        hetong: {
          name: "合同管理",
          path: "/fawuManage/hetong",
          icon: require("../../assets/work/19.png"),
        },
        zhaobiaowenjian: {
          name: "招标文件",
          path: "/fawuManage/zhaobiaowenjian",
          icon: require("../../assets/work/20.png"),
        },
        gongwenchuanyue: {
          name: "公文传阅",
          path: "/gongwenManage/gongwenchuanyue",
          icon: require("../../assets/work/21.png"),
        },
        gongwenliuzhuan: {
          name: "公文流转",
          path: "/gongwenManage/gongwenliuzhuan",
          icon: require("../../assets/work/22.png"),
        },
        xinjianfawen: {
          name: "新建事项",
          path: "/gongwenManage/xinjianfawen",
          icon: require("../../assets/work/28.png"),
        },
        xuanchuanbaodao: {
          name: "宣传报道",
          path: "/gongwenManage/xuanchuanbaodao",
          icon: require("../../assets/work/29.png"),
        },
        neibufawen: {
          name: "内部发文",
          path: "/gongwenManage/neibufawen",
          icon: require("../../assets/work/27.png"),
        },
        // 系统--------------------------开始
        positionCon: {
          name: "岗位配置",
          path: "/sysManage/positionCon",
          icon: require("../../assets/work/44.png"),
        },
        roleCon: {
          name: "角色配置",
          path: "/sysManage/roleCon",
          icon: require("../../assets/work/45.png"),
        },
        userGroup: {
          name: "人员分组",
          path: "/sysManage/userGroup",
          icon: require("../../assets/work/46.png"),
        },
        departmentCon: {
          name: "部门配置",
          path: "/sysManage/departmentCon",
          icon: require("../../assets/work/47.png"),
        },
        jiejiariCon: {
          name: "节假日配置",
          path: "/sysManage/jiejiariCon",
          icon: require("../../assets/work/48.png"),
        },
        cheliangCon: {
          name: "车辆配置",
          path: "/sysManage/cheliangCon",
          icon: require("../../assets/work/49.png"),
        },
        huiyishiCon: {
          name: "会议室配置",
          path: "/sysManage/huiyishiCon",
          icon: require("../../assets/work/50.png"),
        },
        qingjiaCon: {
          name: "请假配置",
          path: "/sysManage/qingjiaCon",
          icon: require("../../assets/work/51.png"),
        },
        yinzhangCon: {
          name: "印章配置",
          path: "/sysManage/yinzhangCon",
          icon: require("../../assets/work/52.png"),
        },
        eveCon: {
          name: "流程配置",
          path: "/sysManage/eveCon",
          icon: require("../../assets/work/53.png"),
        },
        rootCon: {
          name: "系统权限",
          path: "/sysManage/rootCon",
          icon: require("../../assets/work/54.png"),
        },
        // 系统--------------------------结束
        // 绩效管理--------------开始
        createTemplate: {
          name: "建立考核模板",
          path: "/performanceManage/createTemplate",
          icon: require("../../assets/work/62.png"),
        },
        assessment: {
          name: "发起考核",
          path: "/performanceManage/assessment",
          icon: require("../../assets/work/63.png"),
        },
        filling: {
          name: "考核填报",
          path: "/performanceManage/filling",
          icon: require("../../assets/work/64.png"),
        },
        estimate: {
          name: "考核评估",
          path: "/performanceManage/estimate",
          icon: require("../../assets/work/65.png"),
        },
        dataScreening: {
          name: "考核数据总览",
          path: "/performanceManage/dataScreening",
          icon: require("../../assets/work/66.png"),
        },
        Notification: {
          name: "发布绩效通知",
          path: "/performanceManage/Notification",
          icon: require("../../assets/work/67.png"),
        },
        management: {
          name: "部门绩效管理",
          path: "/performanceManage/management",
          icon: require("../../assets/work/68.png"),
        },
        announcement: {
          name: "公告管理",
          path: "/performanceManage/announcement",
          icon: require("../../assets/work/69.png"),
        },
        // 绩效管理--------------结束
        // 党建--------------开始
        dangzuzhi: {
          name: "党组织机构",
          path: "/partyManage/dangzuzhi",
          icon: require("../../assets/work/28.png"),
        },
        partyRole: {
          name: "党组织角色",
          path: "/partyManage/partyRole",
          icon: require("../../assets/work/29.png"),
        },
        partyUser: {
          name: "党组织用户",
          path: "/partyManage/partyUser",
          icon: require("../../assets/work/30.png"),
        },
        partyDues: {
          name: "党费收缴",
          path: "/partyManage/partyDues",
          icon: require("../../assets/work/31.png"),
        },
        questionBank: {
          name: "题库",
          path: "/partyManage/questionBank",
          icon: require("../../assets/work/61.png"),
        },
        examPaper: {
          name: "试卷管理",
          path: "/partyManage/examPaper",
          icon: require("../../assets/work/32.png"),
        },
        marking: {
          name: "阅卷",
          path: "/partyManage/marking",
          icon: require("../../assets/work/33.png"),
        },
        education: {
          name: "学习教育",
          path: "/partyManage/education",
          icon: require("../../assets/work/34.png"),
        },
        activityLedger: {
          name: "党员活动台账",
          path: "/partyManage/activityLedger",
          icon: require("../../assets/work/35.png"),
        },
        mailbox: {
          name: "书记信箱",
          path: "/partyManage/mailbox",
          icon: require("../../assets/work/sjxx.png"),
        },
        // 党建--------------结束
        // 项目管理--------------开始
        openReport: {
          name: "开放申报",
          path: "/projectManagement/openReport",
          icon: require("../../assets/work/36.png"),
        },
        approvalInitiateDeclaration: {
          name: "申报立项",
          path: "/projectManagement/approvalInitiateDeclaration",
          icon: require("../../assets/work/37.png"),
        },
        approveReport: {
          name: "申报审核",
          path: "/projectManagement/approveReport",
          icon: require("../../assets/work/38.png"),
        },
        processProjectList: {
          name: "项目列表",
          path: "/projectManagement/processProjectList",
          icon: require("../../assets/work/39.png"),
        },
        processDataManagement: {
          name: "资料管理",
          path: "/projectManagement/processDataManagement",
          icon: require("../../assets/work/40.png"),
        },
        processDataStatistics: {
          name: "数据统计",
          path: "/projectManagement/processDataStatistics",
          icon: require("../../assets/work/41.png"),
        },
        projectLibrary: {
          name: "项目库",
          path: "/projectManagement/projectLibrary",
          icon: require("../../assets/work/42.png"),
        },
        projectForum: {
          name: "项目论坛",
          path: "/projectManagement/projectForum",
          icon: require("../../assets/work/43.png"),
        },
        // 项目管理--------------结束
        // 项目管理--------------开始
        ScientificData: {
          name: "科研资料库",
          path: "/scientific/ScientificData",
          icon: require("../../assets/work/55.png"),
        },
        ScientificPeople: {
          name: "科研人员管理",
          path: "/scientific/ScientificPeople",
          icon: require("../../assets/work/56.png"),
        },
        ScientificFunding: {
          name: "科研业务专项资金管理",
          path: "/scientific/ScientificFunding",
          icon: require("../../assets/work/57.png"),
        },
        release: {
          name: "发布科研成果考核",
          path: "/scientific/release",
          icon: require("../../assets/work/58.png"),
        },
        Filling: {
          name: "科研成果考核填报",
          path: "/scientific/Filling",
          icon: require("../../assets/work/59.png"),
        },
        approve: {
          name: "科研成果考核审批",
          path: "/scientific/approve",
          icon: require("../../assets/work/60.png"),
        },
        // 项目管理--------------结束
      },
      userRoutes: [],
      renwuActive: 0,
      tongzhiActive: 0,
      approvalProcessDataBeanMapsxuanren: [],
      shenpiDialog: {
        visible: false,
        msg: "",
        manyUserVisible: false,
        manyUserLabel: "选择人员",
        manyUser: [],
        oneUserVisible: false,
        oneUserLabel: "选择人员",
        oneUser: [],
        departVisible: false,
        selectedDeparts: [],
        showSelectChepai: false,
        chepai: "",
        msgVisible: false,
        agreeBtnStr: "同 意",
        idx: 0,
      },
      taskInfo1: [],
      detailDialog: {
        visible: false,
        currentIndex: -1,
        visible0: false,
        id0: 0,
        visible1: false,
        id1: 0,
        visible2: false,
        id2: 0,
        visible3: false,
        id3: 0,
        visible4: false,
        id4: 0,
        visible5: false,
        id5: 0,
        visible6: false,
        id7: 0,
        visible8: false,
        id8: 0,
        visible9: false,
        id9: 0,
        visible10: false,
        id10: 0,
        visible11: false,
        id11: 0,
        visible12: false,
        id12: 0,
        visible13: false,
        id13: 0,
        visible14: false,
        id14: 0,
        visible15: false,
        id15: 0,
        visible16: false,
        id16: 0,
        visible17: false,
        id17: 0,
        visible18: false,
        id18: 0,
        visible19: false,
        id20: 0,
        visible21: false,
        id21: 0,
        visible22: false,
        id22: 0,
        visible23: false,
        id23: 0,
        visible24: false,
        id24: 0,
        visible25: false,
        id25: 0,
        visible26: false,
        id26: 0,
      },
    };
  },
  methods: {
    closeDia(){
      this.isYue = false; // 判断是否阅办
      this.detailDialog.visible = false;
    },
    // 公文流转 - 判断是不是分管领导，
    isFenGuan() {
      const uid = JSON.parse(sessionStorage.getItem("loginUserinfo")).uid;
      // for (let i = 0; i < this.chengbanrenArr.length; i++) {
      //   if (this.chengbanrenArr[i].sta === 0 && this.chengbanrenArr[i].uid === uid&&this.chengbanrenArr[i].fenguan&&this.chengbanrenArr[i].fenguan === 1) {
      //     return true
      //   }
      // }

      const isFenguanChengbanren = this.chengbanrenArr.some(item => {
        return item.sta === 0 && item.uid === uid && item.fenguan === 1;
      });

      if (isFenguanChengbanren) {
        return true;
      }
    },

    // 公文流转 -- 判断是不是承办部门负责人，要选择具体经办人
    isChenBanLeaderFun(){
      const uid = JSON.parse(sessionStorage.getItem("loginUserinfo")).uid;
      // for (let i = 0; i < this.chengbanrenArr.length; i++) {
      //   if (this.chengbanrenArr[i].sta === 0 && this.chengbanrenArr[i].uid === uid && !this.chengbanrenArr[i].fenguan&& this.chengbanrenArr[i].positionName != '行政助理') {
      //     return true
      //   }
      // }

      const isMatchedChengbanren = this.chengbanrenArr.some(item => {
        return item.sta === 0 && item.uid === uid && !item.fenguan && item.positionName !== '行政助理';
      });

      if (isMatchedChengbanren) {
        return true;
      }
    },

    // 初始化时候，先获取行政事务通知
    getxingZheng() {
      websock
        .getNotificationListWithStatusWeb({
          status: this.tongzhiActive,
          ...this.listParams,
        })
        .then((res) => {
          res.list = res.list || [];
          for (let i = 0; i != res.list.length; i++) {
            res.list[i].typRaw = res.list[i].typ;
            res.list[i].typ = this.getTypeStr(res.list[i].typ);
            res.list[i].createTime = this.formatYearMonthDay(
              res.list[i].createTime
            );
          }
          this.myTaskData2 = res.list;
          this.myTas2Total = res.count;
        })
        .catch((err) => {
          console.error(err);
        });
    },

    getPosition(id, arr) {
      for (let i = 0; i < arr.length; i++) {
        if (id == arr[i].id) {
          return arr[i].name;
        }
      }
    },

    // 判断数组中相邻的两个数据是否相同
    hasAdjacentDuplicates(arr) {
      for (let i = 0; i < arr.length - 1; i++) {
        if (arr[i] === arr[i + 1]) {
          return i;
        }
      }
      return false;
    },

    getTaskStaStr(sta) {
      if (sta === 0) {
        return "待处理";
      } else if (sta === 1) {
        return "同意";
      } else if (sta === 2) {
        return "拒绝";
      } else if (sta === 3) {
        return "已撤回";
      }
    },
    async handleChangeCascader(e) {
      console.log(this.taskInfo1.data.userList);
      console.log(e);
      this.xuanzeID = e;
      let arr = [];
      const res = await websock.getContactList();
      if (
        this.xuanzeSHOW == "宣教科负责人" &&
        this.xuanzeSHOW2 == "1" &&
        this.xuanzeSHOW3 ==
          JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
      ) {
        res.forEach((item) => {
          if (item) {
            item.userList.forEach((items) => {
              if (items.uid == e) {
                arr.push(this.approvalProcessDataBeanMaps[0], {
                  msg: "",
                  name: items.name,
                  signimg: "",
                  sta: "0",
                  stepName: items.positionName,
                  ts: "",
                  uid: items.uid,
                });
              }
            });
            //
          }
        });

        console.log(arr);
        this.approvalProcessDataBeanMapsxuanren = arr;
        // this.approvalProcessDataBeanMaps.push()
      }
    },
    resetIds() {
      this.detailDialog.id0 = 0;
      this.detailDialog.id1 = 0;
      this.detailDialog.id2 = 0;
      this.detailDialog.id3 = 0;
      this.detailDialog.id4 = 0;
      this.detailDialog.id5 = 0;
      this.detailDialog.id6 = 0;
      this.detailDialog.id7 = 0;
      this.detailDialog.id8 = 0;
      this.detailDialog.id9 = 0;
      this.detailDialog.id10 = 0;
      this.detailDialog.id11 = 0;
      this.detailDialog.id12 = 0;
      this.detailDialog.id13 = 0;
      this.detailDialog.id14 = 0;
      this.detailDialog.id15 = 0;
      this.detailDialog.id16 = 0;
      this.detailDialog.id17 = 0;
      this.detailDialog.id18 = 0;
      this.detailDialog.id19 = 0;
      this.detailDialog.id20 = 0;
      this.detailDialog.id21 = 0;
      this.detailDialog.id22 = 0;
      this.detailDialog.id23 = 0;
      this.detailDialog.id24 = 0;
      this.detailDialog.id25 = 0;
      this.detailDialog.id26 = 0;
    },
    async getUserList() {
      const res = await websock.getContactList();
      const userList = [];
      for (let i = 0; i !== res.length; i++) {
        userList.push({
          value: i + "",
          label: res[i].name,
          children: [],
        });
        for (let j = 0; j !== res[i].userList.length; j++) {
          userList[i].children.push({
            value: res[i].userList[j].uid,
            label: res[i].userList[j].name,
            disabled:
              res[i].userList[j].uid ==
              JSON.parse(sessionStorage.getItem("loginUserinfo")).uid,
          });
        }
      }
      this.cascaderData = userList;
    },
    getTypeStr(typ) {
      if (typ == 0) {
        return "请假";
      }
      if (typ == 1) {
        return "出差";
      }
      if (typ == 2) {
        return "加班";
      }
      if (typ == 3) {
        return "入职";
      }
      if (typ == 4) {
        return "转正";
      }
      if (typ == 5) {
        return "离职";
      }
      if (typ == 6) {
        return "督办单";
      }
      if (typ == 7) {
        return "会议室";
      }
      if (typ == 8) {
        return "接待单";
      }
      if (typ == 9) {
        return "车辆加油";
      }
      if (typ == 10) {
        return "用车申请";
      }
      if (typ == 11) {
        return "用印申请";
      }
      if (typ == 13) {
        return "采购单";
      }
      if (typ == 14) {
        return "物资领用";
      }
      if (typ == 15) {
        return "合同审核";
      }
      if (typ == 16) {
        return "招标文件";
      }
      if (typ == 17) {
        return "传阅文件";
      }
      if (typ == 18) {
        return "公文流转";
      }
      if (typ == 19) {
        return "补卡审核";
      }
      if (typ == 20) {
        return "会议通知";
      }
      if (typ == 21) {
        return "工作通知";
      }
      if (typ == 22) {
        return "排班详情";
      }
      if (typ == 23) {
        return "内部发文";
      }
      if (typ == 24) {
        return "新建事项";
      }
      if (typ == 25) {
        return "宣传报道";
      }
      if (typ == 26) {
        return "工作餐";
      }
      return "其它";
    },
    formatYearMonthDay(src) {
      return moment(src).format("YYYY-MM-DD");
    },
    formatContent(content) {
      if (!content) return "";
      return content.replace(/<br>/g, "\n");
    },
    getTaskListUntreated() {
      websock
        .getTaskListWithStatusWeb({
          status: 0,
          pageNum: this.taskInfo.untreated.pageNum,
          pageSize: this.taskInfo.untreated.pageSize,
        })
        .then((res) => {
          this.taskInfo.untreated.data = res.list;
          this.taskInfo.untreated.pageTotal = res.count;
        });
    },
    getTaskListCompleted() {
      websock
        .getTaskListWithStatusWeb({
          status: 1,
          pageNum: this.taskInfo.completed.pageNum,
          pageSize: this.taskInfo.completed.pageSize,
        })
        .then((res) => {
          this.taskInfo.completed.data = res.list;
          this.taskInfo.completed.pageTotal = res.count;
        });
    },
    // 获取任务列表
    getTaskList() {
      this.getTaskListUntreated();
      this.getTaskListCompleted();
    },
    // 获取当前时间
    async getTime(time) {
      let date;
      if (time) {
        date = new Date(time);
      } else {
        date = new Date();
      }
      const year = date.getFullYear();
      const month = date.getMonth() + 1; // getMonth()返回值是0~11
      const day = date.getDate();
      const daily =
        year +
        "-" +
        (month < 10 ? "0" + month : month) +
        "-" +
        (day < 10 ? "0" + day : day);
      let res = await getDailyTaskApi(daily);
      this.scheduleArr = res.data.length ? res.data : [];

      res = await websock.getSchedule({ date: daily });
      for (let i = 0; i != res.length; i++) {
        if (res[i].dailyDay == "上午") {
          let find = false;
          for (let j = 0; j != this.scheduleArr.length; j++) {
            if (this.scheduleArr[j].dailyDay == "上午") {
              find = true;
              break;
            }
          }
          if (!find) {
            this.scheduleArr.unshift({
              dailyDay: "上午",
              dailyTaskList: [],
            });
          }
          this.scheduleArr[0].dailyTaskList.push(res[i]);
        } else if (res[i].dailyDay == "下午") {
          let find = false;
          for (let j = 0; j != this.scheduleArr.length; j++) {
            if (this.scheduleArr[j].dailyDay == "下午") {
              find = true;
              break;
            }
          }
          if (!find) {
            this.scheduleArr.push({
              dailyDay: "下午",
              dailyTaskList: [],
            });
          }
          this.scheduleArr[this.scheduleArr.length - 1].dailyTaskList.push(
            res[i]
          );
        }
      }
    },

    async handleTongzhiInfoClose() {
      if (this.tabsIndex == 0) {
        if (this.tongInfo.sta == 0) {
          // 未读
          await websock.readNotification({
            id: this.tongInfo.id,
          });

          this.clickTabs(this.tongzhiTabs[this.tabsIndex], this.tabsIndex);
          this.msgSuccess("消息已读");
          this.gerCommonNumApi(0);
        }
        this.tongInfo = {};
        this.seeInfoDiaV = false;
        return;
      }

      const isRead = this.tongInfo.isRead
        ? Number(this.tongInfo.isRead)
        : Number(this.tongInfo.status);

      if (isRead) {
        this.tongInfo = {};
        this.seeInfoDiaV = false;
      } else {
        let data;
        if (this.tabsIndex == 1 || this.tabsIndex == 2) {
          data = {
            id: this.tongInfo.id,
            isRead: 2,
          };
        } else if (
          this.tabsIndex == 3 ||
          this.tabsIndex == 4 ||
          this.tabsIndex == 5
        ) {
          data = this.tongInfo.djNoticeId;
        } else if (this.tabsIndex == 6) {
          data = this.tongInfo.projectNoticeId;
        } else {
          return;
        }

        changeStatusApi(this.tabsIndex, data)
          .then((res) => {
            if (res.code == 0) {
              this.tongInfo = {};
              this.seeInfoDiaV = false;
              this.clickTabs(this.tongzhiTabs[this.tabsIndex], this.tabsIndex);
              this.msgSuccess("消息已读");
              this.gerCommonNumApi(0);
            }
          })
          .catch((err) => {
            console.log(err);
          });
      }
    },

    async handleTongzhiSeeInfo(row) {
      console.log("handleTongzhiSeeInfo", row);
      console.log(this.tabsIndex);

      websock.gongwenLiuzhuanDetail({ id: row.relevenceId }).then((data) => {
        console.log(data.readers)
        let readers = data.readers;
        if (readers && readers.length) {
          let loginId = JSON.parse(sessionStorage.getItem('loginUserinfo')).uid;
          for (let i = 0; i < readers.length; i++) {
            if (readers[i].uid === loginId && this.tabsIndex == 0) {
              websock.gongwenliuzhuanYueban({ id: row.relevenceId })
                .then((res) => {
                  this.msgSuccess("阅办成功");
                  this.isYue = true;
                })
            }
          }
        }
      })

      if (this.tabsIndex == 0) {
        this.seeDetail(row.typRaw, row.relevenceId);

        await websock.readNotification({
          id: row.id,
        });
        // this.tongInfo = row;
        // this.seeInfoDiaV = true;
        return;
      }

      let data = {};
      if (this.tabsIndex == 1 || this.tabsIndex == 2) {
        data = {
          id: row.id,
          isRead: 2,
        };
      } else if (this.tabsIndex == 3 || this.tabsIndex == 4) {
        data = row.djNoticeId;
      } else if (this.tabsIndex == 5) {
        data.dqActivityId = row.djCostId;
      } else if (this.tabsIndex == 6) {
        data = row.projectNoticeId;
      } else {
        return;
      }
      console.log(this.tabsIndex);

      // 获取活动地点
      let placeList = [];
      activityPlaceListApi().then((res) => {
        placeList = res.data;
      });

      tongSeeinfoApi(this.tabsIndex, data)
        .then((res) => {
          if (res.code == 0) {
            // 只有5 党群活动,可以查看。其他的都是通知知晓
            if (this.tabsIndex == 5) {
              // 党群活动通知 5
              const data = res.data;
              this.tongInfo = {
                isRead: row.isRead ? row.isRead : row.status,
                djNoticeId: row.djNoticeId,
                // 活动主题
                activityTheme: data.activityTheme,
                // 活动类型(1党员大会 2支部委员会 3 党小组会 4 党课 5 党员统一活动日 6 特色活动)
                activityType: data.activityType,
                // 发布状态 (0 草稿箱 1已发布)
                draftsStatus: data.draftsStatus == 1 ? "已发布" : "草稿箱",
                // 活动开始时间
                activityStartTime: data.activityStartTime,
                // 活动结束时间
                activityEndTime: data.activityEndTime,
                // 	活动地点
                activityPlace: this.getPosition(data.activityPlace, placeList),
                // 参与人员
                participant: JSON.parse(data.participant),
                // 活动内容
                activityContent: data.activityContent,
                // 封面
                coverUrl: data.coverUrl ? JSON.parse(data.coverUrl) : [],
                // 附件链接
                accessoryUrl: data.accessoryUrl
                  ? JSON.parse(data.accessoryUrl)
                  : [],
                // 创建时间
                createTime: data.createTime,
                // 签到二维码地址
                qrCodeUrl: data.qrCodeUrl,
              };

              this.seeInfoDiaV = true;
            } else {
              if (res.code === 0) {
                this.msgSuccess("操作成功");
                this.gerCommonNumApi(0);
                this.clickTabs(
                  this.tongzhiTabs[this.tabsIndex],
                  this.tabsIndex
                );
              } else {
                this.msgSuccess("操作失败");
              }
            }
          }
        })
        .catch((err) => {
          console.log(err);
          this.msgError("操作失败");
        });
    },

    handleTongzhiEvent() {
      this.clickTabs(this.tongzhiTabs[this.tabsIndex], this.tabsIndex);
    },
    // 获取我的通知未读数量
    gerCommonNumApi(status) {
      commonNumApi(status)
        .then(async (res) => {
          if (res.code == 0 && res.data) {
            this.tongzhiTabs = res.data;
            this.tongzhiTabs.unshift({
              name: "行政事务通知",
              count: 0,
            });
            const r = await websock.getUnreadNotificationCnt();
            this.tongzhiTabs[0].count = r;
            // 计算未读数量
            this.weiduNum = this.tongzhiTabs.reduce(
              (sum, v) => sum + v.count,
              0
            );
            // this.clickTabs(this.tongzhiTabs[this.tabsIndex], this.tabsIndex);
          }
        })
        .catch((err) => {
          console.log(err);
        });
    },
    clickTabs(i, index, isResetlistParams = false) {
      this.tabsIndex = index;
      const userUid = JSON.parse(sessionStorage.getItem("loginUserinfo")).uid;
      // 是否将分页参数重置
      if (isResetlistParams) {
        this.listParams.pageNum = 1;
        this.listParams.pageSize = 10;
      }

      const other = [
        {
          name: "绩效管理通知",
          params: {
            isRead: this.tongzhiActive == 0 ? 0 : 2,
            userUid,
            queryType: -1,
            ...this.listParams,
          },
        },
        {
          name: "科研管理通知",
          params: {
            isRead: this.tongzhiActive == 0 ? 0 : 2,
            userUid,
            queryType: -2,
            ...this.listParams,
          },
        },
        {
          name: "党费收缴通知",
          params: {
            status: this.tongzhiActive == 0 ? 0 : 2,
            ...this.listParams,
          },
        },
        {
          name: "理论测验通知",
          params: {
            status: this.tongzhiActive == 0 ? 0 : 2,
            ...this.listParams,
          },
        },
        {
          name: "党群活动通知",
          params: {
            status: this.tongzhiActive == 0 ? 0 : 2,
            uid: userUid,
            ...this.listParams,
          },
        },
        {
          name: "项目管理通知",
          params: {
            status: this.tongzhiActive == 0 ? 0 : 2,
            ...this.listParams,
          },
        },
      ];

      if (index == 0) {
        websock
          .getNotificationListWithStatusWeb({
            status: this.tongzhiActive,
            ...this.listParams,
          })
          .then((res) => {
            res.list = res.list || [];
            for (let i = 0; i != res.list.length; i++) {
              res.list[i].typRaw = res.list[i].typ;
              res.list[i].typ = this.getTypeStr(res.list[i].typ);
              res.list[i].createTime = this.formatYearMonthDay(
                res.list[i].createTime
              );
            }
            this.myTaskData2 = res.list;
            this.myTas2Total = res.count;
          })
          .catch((err) => {
            console.error(err);
          });
      } else {
        const foundItem = other.find((item) => item.name === i.name);
        commonInfoApi(i.name, foundItem.params)
          .then((res) => {
            if (res.code == 0 && res.data) {
              this.myTaskData2 = res.data;
              this.myTas2Total = res.total;
            }
          })
          .catch((err) => {
            console.log(err);
          });
      }
      this.seeInfoDiaV = false;
    },
    clickTongZhi(index) {
      this.tongzhiActive = index;
      // this.gerCommonNumApi(2);
      this.clickTabs(this.tongzhiTabs[this.tabsIndex], this.tabsIndex);
    },
    // 点击代办已办
    clickRenWu(index) {
      this.taskInfo.cur = index;
      this.getTaskList();
    },
    // 切换时间
    onChange(date) {
      this.getTime(date._d);
    },
    addMenuFun() {
      const pattern = /\/(\w+)$/;
      const pathArr = this.saveRoute.map((v) => {
        return v.path.match(pattern)[1];
      });
      const data = {
        commonMenuList: pathArr,
        client: "WEB",
      };

      commonMenuAddApi(data)
        .then((res) => {
          if (res.code == 0) {
            this.msgSuccess("添加成功");
            this.customDia = false;
            this.getCommonMenu();
          }
        })
        .catch();
    },
    // 减去路径
    subRoute(index) {
      this.saveRoute.splice(index, 1);
    },
    // 添加路径
    addRoute(item) {
      if (this.saveRoute.length >= 8) {
        this.msgInfo("常用功能最多添加8个,超出的部分请先移除后添加");
      } else {
        const saveRouteS = JSON.stringify(this.saveRoute);
        const itemS = JSON.stringify(item);

        const index = saveRouteS.indexOf(itemS);

        if (index !== -1) {
          this.msgInfo("该功能已经添加,请勿重复添加");
          return;
        } else {
          this.saveRoute.push(item);
        }
      }
    },
    // 关闭自定义
    handleClose() {
      this.customDia = false;
    },
    // 弹出自定义常用功能
    handleCustomDia() {
      const saveRouteString = JSON.stringify(this.routesUi);
      this.saveRoute = JSON.parse(saveRouteString);

      const userRoutes = sessionStorage.getItem("userRoutes");
      const userRouteArr = userRoutes ? JSON.parse(userRoutes) : [];

      const allRoutes = [];

      for (let i = 0; i != this.uiCfg.length; i++) {
        const routes = [];
        const rts = this.uiCfg[i].routes;
        for (let j = 0; j != rts.length; j++) {
          const rt = rts[j];
          if (userRouteArr.indexOf(rt) != -1) {
            if (this.routesCfg[rt]) {
              routes.push(this.routesCfg[rt]);
            }
          }
        }

        if (routes.length > 0) {
          allRoutes.push({
            name: this.uiCfg[i].name,
            routes: routes,
          });
        }
      }

      // this.saveRoute;
      // for (let i = 0; i < allRoutes.length; i++) {
      //   for (let j = 0; j < this.saveRoute.length; j++) {
      //     if (allRoutes[i] == this.saveRoute[j]) {
      //       allRoutes.split(i, 1);
      //     }
      //   }
      // }
      this.allRoutes = allRoutes;

      this.customDia = true;
    },

    // 获取常用功能
    getCommonMenu() {
      commonMenuApi()
        .then((res) => {
          console.log(res);
          if (
            res.code == 0 &&
            res.data &&
            res.data.commonMenuList &&
            res.data.commonMenuList.length
          ) {
            this.normalFeatures = res.data.commonMenuList;
          } else {
            this.normalFeatures;
          }
          this.updateUiRoutes();
        })
        .catch((err) => {
          console.log(err);
          this.updateUiRoutes();
        });
    },
    updateUiRoutes() {
      this.routesUi = [];
      for (let i = 0; i < this.normalFeatures.length; i++) {
        const rt = this.normalFeatures[i];
        if (this.userRoutes.indexOf(rt) != -1) {
          if (this.routesCfg[rt]) {
            this.routesUi.push(this.routesCfg[rt]);
          }
        }
      }
    },
    goToPath(p) {
      this.$router.push(p);
    },

    updateTime() {
      this.dateStr = moment().format("YYYY/MM/DD");
      this.timeStr = moment().format("HH:mm:ss");
      this.weekStr =
        "周" +
        ["日", "一", "二", "三", "四", "五", "六"][moment().get("weekday")];
    },
    async getTaskRedPoint() {
      const res = await websock.getUnfinishedTaskCnt();
      if (res === 0) return (this.taskRedPoint = "");
      if (res > 99) return (this.taskRedPoint = "99+");
      this.taskRedPoint = res + "";
    },
    async getNoticeRedPoint() {
      const res = await websock.getUnreadNotificationCnt();
      if (res === 0) return (this.noticeRedPoint = "");
      if (res > 99) return (this.noticeRedPoint = "99+");
      this.noticeRedPoint = res + "";
    },
    async showShenpiDialog(idx, row) {
      this.relevenceId = row.relevenceId;
      const applyInfo = await websock.gongwenLiuzhuanDetail({
        id: row.relevenceId,
      });
      console.log(applyInfo)

      let  auditors;
      if (applyInfo.auditors) {
        auditors = Array.from(Object.values(applyInfo.auditors), (x) => x);
        this.auditorsArr = auditors;
      }

      // 分管领导
      let chengbanren;
      if (applyInfo.chengbanren) {
        chengbanren = Array.from(Object.values(applyInfo.chengbanren), (x) => x);
        this.chengbanrenArr = chengbanren;
      }


      console.log(auditors, chengbanren, 'auditors,chengbanren')
      let sunArr = [];
      if (auditors) {
        sunArr = auditors;
      }
      if (chengbanren) {
        sunArr = sunArr.concat(chengbanren);
      }
      for (let i = 0; i < sunArr.length; i++) {
        console.log(sunArr)
        if (sunArr[i].sta == 0) {
          this.step = i+1;
          console.log(i+1, `进行到了第${i+1}个人`);
          break;
        }
      }

      this.userId = "";
      this.isChengban = row.isChengban;
      this.shenpiDialog.msg = "";
      this.shenpiDialog.idx = idx;
      this.shenpiDialog.manyUserVisible = false;
      this.shenpiDialog.oneUserVisible = false;
      this.shenpiDialog.manyUserLabel = "选择人员";
      this.shenpiDialog.oneUserLabel = "选择人员";
      this.shenpiDialog.manyUser = [];
      this.shenpiDialog.oneUser = [];
      this.shenpiDialog.msgVisible = true;
      this.shenpiDialog.agreeBtnStr = "同 意";
      let taskInfo = this.taskInfo.untreated.data[idx];
      if (this.taskInfo.cur == 1) {
        taskInfo = this.taskInfo.untreated.data[idx];
      }

      // 公文流转
      if (taskInfo.typ == 18 && this.step > 2) {
        return
      }
      console.log(sunArr, 'sunArrsunArr')

      if (taskInfo.typ == 24) {
        this.idd = row.relevenceId;
        this.taskIdd = row.id;
        const res = await getXinjian(row.relevenceId, row.id);
        console.log(res);
        this.xuanzeSHOW =
          res.data.newDispatch.approvalProcessDataBeanMap.auditor0.stepName;
        if (res.data.newDispatch.approvalProcessDataBeanMap.auditor1) {
          this.xuanzeSHOW2 =
            res.data.newDispatch.approvalProcessDataBeanMap.auditor1.stepName;
        }
        this.xuanzeSHOW3 =
          res.data.newDispatch.approvalProcessDataBeanMap.auditor0.uid;

        const approvalProcessDataBeanMaps = Array.from(
          Object.values(res.data.newDispatch.approvalProcessDataBeanMap),
          (x) => x
        );
        this.approvalProcessDataBeanMaps = approvalProcessDataBeanMaps;

        this.xinjainfawenShow = true;
        this.shenpiDialog.agreeBtnStr1 = "同 意";
        this.shenpiDialog.agreeBtnStr2 = "撤 销";
      } else if (taskInfo.typ == 25 && row.isChengban == 0) {
        this.idd = row.relevenceId;
        this.taskIdd = row.id;
        const res = await getxuanchuan(row.relevenceId, row.id);
        const approvalProcessDataBeanMaps = Array.from(
          Object.values(res.data.propagandaReport.approvalProcessDataBeanMap),
          (x) => x
        );
        this.approvalProcessDataBeanMaps = approvalProcessDataBeanMaps;
        this.xuanchuanbaodaoShow = true;
        this.shenpiDialog.agreeBtnStr1 = "同 意";
        this.shenpiDialog.agreeBtnStr2 = "撤 销";
      } else if (taskInfo.typ == 25 && row.isChengban == 1) {
        this.idd = row.relevenceId;
        this.taskIdd = row.id;
        const res = await getxuanchuan(row.relevenceId, row.id);
        console.log(res);
        this.xuanzeSHOW =
          res.data.propagandaReport.undertakeProcessDataMap.chengban0.stepName;
        this.xuanzeSHOW2 = row.isChengban;
        this.xuanzeSHOW3 =
          res.data.propagandaReport.undertakeProcessDataMap.chengban0.uid;
        const approvalProcessDataBeanMaps = Array.from(
          Object.values(res.data.propagandaReport.undertakeProcessDataMap),
          (x) => x
        );
        this.approvalProcessDataBeanMaps = approvalProcessDataBeanMaps;

        this.xuanchuanbaodaoShow = true;
        // this.shenpiDialog.agreeBtnStr1 = "已完成";
        // this.shenpiDialog.agreeBtnStr2 = "撤 销";
      } else if (taskInfo.typ == 26) {
        this.idd = row.relevenceId;
        this.taskIdd = row.id;
        const res = await getgongzuocan(row.relevenceId, row.id);
        const approvalProcessDataBeanMaps = Array.from(
          Object.values(res.data.workingLunch.approvalProcessDataBeanMap),
          (x) => x
        );
        this.approvalProcessDataBeanMaps = approvalProcessDataBeanMaps;
        this.gongzuocanShow = true;
        this.shenpiDialog.agreeBtnStr1 = "同 意";
        this.shenpiDialog.agreeBtnStr2 = "撤 销";
      } else {
        this.shenpiDialog.visible = true;
      }

      // 会议室申请 承办阶段 第一个承办人 选择单人 选择具体承办
      if (taskInfo.typ == 7 && taskInfo.isChengban && taskInfo.pos == 0) {
        this.shenpiDialog.oneUserVisible = true;
        this.shenpiDialog.oneUserLabel = "选择经办人";
        this.shenpiDialog.agreeBtnStr = "确定";
        this.shenpiDialog.msgVisible = false;
      }
      // 用车申请 车队长选择车牌号
      if (taskInfo.typ == 10 && this.userInfo.uid == 12) {
        this.shenpiDialog.showSelectChepai = true;
      }
      // 传阅文件 承办阶段 周莉 选择多人 分发范围
      if (taskInfo.typ == 17) {
        if (taskInfo.isChengban) {
          this.shenpiDialog.agreeBtnStr = "确定";
          if (this.userInfo.uid == 10) {
            this.shenpiDialog.manyUserVisible = true;
            this.shenpiDialog.manyUserLabel = "选择分发范围";
            this.shenpiDialog.msgVisible = false;
          }
        }
      }
      // 公文流转
      if (taskInfo.typ == 18) {
        return
        this.liuchengType=18;
        if (!taskInfo.isChengban && taskInfo.pos == 0) {
          this.selectBtnStr = "拟办意见";
        }

        // 审核阶段 第二个审核人 显示选择分管领导
        if (!taskInfo.isChengban && taskInfo.pos == 2) {
          this.shenpiDialog.manyUserVisible = true;
          this.shenpiDialog.manyUserLabel = "选择分管领导";
          this.selectBtnStr = "选择分管领导";
        }

        // 承办阶段 分管领导选择责任部门
        if (taskInfo.isChengban) {
          const applyInfo = await websock.gongwenLiuzhuanDetail({
            id: taskInfo.relevenceId,
          });
          const chengbanren = applyInfo.chengbanren;
          if (
            chengbanren["chengbanren" + taskInfo.pos] &&
            chengbanren["chengbanren" + taskInfo.pos].fenguan
          ) {
            this.shenpiDialog.departVisible = true;
          } else {
            // 分管领导选择责任部门 其他选择经办人
            this.shenpiDialog.manyUserVisible = true;
            this.shenpiDialog.manyUserLabel = "选择经办人";
            this.selectBtnStr = "选择经办人";
          }
        }
      }
    },
    seeDetail(typ, id) {
      for (let i = 0; i <= 26; i++) {
        this.detailDialog["visible" + i] = false;
      }

      this.detailDialog.visible = true;
      this.detailDialog["visible" + typ] = true;
      this.detailDialog["id" + typ] = id;
      // this.taskIds = idsd;
    },
    clickAgreeBtn() {
      let taskInfo = this.taskInfo.untreated.data[this.shenpiDialog.idx];
      if (this.taskInfo.cur == 1) {
        taskInfo = this.taskI;
      }
      if (taskInfo.isChengban) {
        this.confirmTask();
      } else {
        this.agreeTask();
      }
    },
    // 1新建发文2宣传报道审批同意
    async clickAgreeBtn1(rows) {
      if (rows == 1) {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 1;
            data.ts = timestamp;
          }
        });

        if (
          this.xuanzeSHOW == "部门负责人" &&
          this.userId == "" &&
          this.xuanzeSHOW3 ==
            JSON.parse(sessionStorage.getItem("loginUserinfo")).uid &&
          this.xuanzeSHOW2 == "分管领导"
        ) {
          this.$message.error("请选择分管领导");
          return;
        } else {
          this.approvalProcessDataBeanMaps.forEach((names) => {
            if (names.stepName == "分管领导") {
              this.taskInfo1.data.userList.forEach((item) => {
                if (item.uid == this.xuanzeID) {
                  names.signimg = item.signimg;
                  names.uid = item.uid;
                  names.name = item.name;
                }
              });
            }
          });
        }

        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        console.log(OldObject);
        const approvalProcessDataBeanMaps = Array.from(
          Object.values(OldObject),
          (x) => x
        );
        // 判断选择的相邻的两个人是否相同
        const uIdArr = this.approvalProcessDataBeanMaps.map((v) => {
          return v.uid;
        });
        if (uIdArr.length > 2) {
          let res = this.hasAdjacentDuplicates(uIdArr);
          if (
            res &&
            approvalProcessDataBeanMaps[0].sta == 1 &&
            approvalProcessDataBeanMaps[res].sta == 1
          ) {
            approvalProcessDataBeanMaps[res].sta = 1;
            approvalProcessDataBeanMaps[res + 1].sta = 1;
            this.stas = true;
          } else {
            this.stas = false;
          }
        }
        console.log(approvalProcessDataBeanMaps);
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          sta: this.stas == true ? 1 : null,
          approvalProcessDataBeanMap: OldObject,
        };
        console.log(params);
        try {
          const res = await shenpiXinjian(params);
          if (res.code == 0) {
            this.$message.success("审批成功");
            this.getTaskList();
          }
        } catch (err) {
          console.error(err);
        }
        this.xinjainfawenShow = false;
      } else if (rows == 2) {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 1;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };

        try {
          const res = await shenpixuanchuan(params);
          if (res.code == 0) {
            this.$message.success("审批成功");
            this.getTaskList();
          }
        } catch (err) {
          console.error(err);
        }
        this.xuanchuanbaodaoShow = false;
      } else if (rows == 4) {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 1;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpigongzuocan(params);
          if (res.code == 0) {
            this.$message.success("审批成功");
            this.getTaskList();
          }
        } catch (err) {
          console.error(err);
        }
        this.gongzuocanShow = false;
      } else {
        const timestamp = new Date().getTime();
        if (this.approvalProcessDataBeanMapsxuanren.length > 0) {

          this.approvalProcessDataBeanMapsxuanren.forEach((data) => {
            if (
              data.uid ==
              JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
            ) {
              data.msg = this.msg;
              data.sta = 1;
              data.ts = timestamp;
            }
          });
          this.approvalProcessDataBeanMapsxuanren.forEach((names) => {
            this.taskInfo1.data.userList.forEach((item) => {
              if (item.uid == names.uid) {
                names.signimg = item.signimg;
              }
            });
          });
          const OldObject = this.approvalProcessDataBeanMapsxuanren.reduce(
            (o, n, i) => {
              o["chengban" + i] = {
                ts: n.ts,
                msg: n.msg,
                sta: n.sta,
                signimg: n.signimg,
                uid: n.uid,
                stepName: n.stepName,
                name: n.name,
              };
              return o;
            },
            {}
          );
          const params = {
            id: this.idd,
            taskId: this.taskIdd,
            undertakeProcessDataBeanMap: OldObject,
          };
          try {
            const res = await shenpixuanchuan(params);
            if (res.code == 0) {
              this.$message.success("审批成功");
              this.getTaskList();
            }
          } catch (err) {
            console.error(err);
          }
        } else {

          this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 1;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["chengban" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          undertakeProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpixuanchuan(params);
          if (res.code == 0) {
            this.$message.success("审批成功");
            this.getTaskList();
          }
        } catch (err) {
          console.error(err);
        }
        }

        this.xuanchuanbaodaoShow = false;
      }
    },
    // 1新建发文2宣传报道审批撤销
    async clickAgreeBtn2(rows) {
      if (rows == 1) {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 3;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpiXinjian(params);
          if (res.code == 0) {
            this.getTaskList();
            this.$message.success("审批成功");
          }
        } catch (err) {
          console.error(err);
        }
        this.xinjainfawenShow = false;
      } else if (rows == 4) {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 3;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpigongzuocan(params);
          if (res.code == 0) {
            this.getTaskList();
            this.$message.success("审批成功");
          }
        } catch (err) {
          console.error(err);
        }
        this.gongzuocanShow = false;
      } else {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 3;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpixuanchuan(params);
          if (res.code == 0) {
            this.getTaskList();
            this.$message.success("审批成功");
          }
        } catch (err) {
          console.error(err);
        }
        this.xuanchuanbaodaoShow = false;
      }
    },
    // 1新建发文2宣传报道审批拒绝
    async rejectTask1(rows) {
      if (rows == 1) {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 2;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpiXinjian(params);
          if (res.code == 0) {
            this.$message.success("审批成功");
            this.getTaskList();
          }
        } catch (err) {
          console.error(err);
        }
        this.xinjainfawenShow = false;
      } else if (rows == 4) {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 2;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpigongzuocan(params);
          if (res.code == 0) {
            this.$message.success("审批成功");
            this.getTaskList();
          }
        } catch (err) {
          console.error(err);
        }
        this.gongzuocanShow = false;
      } else {
        const timestamp = new Date().getTime();
        this.approvalProcessDataBeanMaps.forEach((data) => {
          if (
            data.uid == JSON.parse(sessionStorage.getItem("loginUserinfo")).uid
          ) {
            data.msg = this.msg;
            data.sta = 2;
            data.ts = timestamp;
          }
        });
        this.approvalProcessDataBeanMaps.forEach((names) => {
          this.taskInfo1.data.userList.forEach((item) => {
            if (item.uid == names.uid) {
              names.signimg = item.signimg;
            }
          });
        });
        const OldObject = this.approvalProcessDataBeanMaps.reduce((o, n, i) => {
          o["auditor" + i] = {
            ts: n.ts,
            msg: n.msg,
            sta: n.sta,
            signimg: n.signimg,
            uid: n.uid,
            stepName: n.stepName,
            name: n.name,
          };
          return o;
        }, {});
        const params = {
          id: this.idd,
          taskId: this.taskIdd,
          approvalProcessDataBeanMap: OldObject,
        };
        try {
          const res = await shenpixuanchuan(params);
          if (res.code == 0) {
            this.$message.success("审批成功");
            this.getTaskList();
          }
        } catch (err) {
          console.error(err);
        }
        this.xuanchuanbaodaoShow = false;
      }
    },
    agreeTask() {
      this.shenpiDialog.visible = false;
      this.resetIds();
      const users = [];
      if (this.shenpiDialog.manyUser.length > 0) {
        for (let i = 0; i != this.shenpiDialog.manyUser.length; i++) {
          users.push(JSON.parse(this.shenpiDialog.manyUser[i][1]));
        }
      }
      if (this.shenpiDialog.oneUser.length > 0) {
        users.push(JSON.parse(this.shenpiDialog.oneUser[1]));
      }
      let taskInfo = this.taskInfo.untreated.data[this.shenpiDialog.idx];
      if (this.taskInfo.cur == 1) {
        taskInfo = this.taskInfo.completed.data[this.shenpiDialog.idx];
      }

      // 公文流转
      if (taskInfo.typ == 18 && taskInfo.pos == 2 && users.length == 0) {
        return this.$message.error("请选择分管领导");
      }
      websock
        .agreeTask({
          id: taskInfo.id,
          msg: this.shenpiDialog.msg || "",
          chepai: this.shenpiDialog.showSelectChepai
            ? this.shenpiDialog.chepai
            : "",
          users,
        })
        .then(() => {
          this.step = 0;
          this.getTaskList();
        });
    },
    confirmTask() {
      this.shenpiDialog.visible = false;
      this.resetIds();
      const users = [];
      if (this.shenpiDialog.manyUser.length > 0) {
        for (let i = 0; i != this.shenpiDialog.manyUser.length; i++) {
          users.push(JSON.parse(this.shenpiDialog.manyUser[i][1]));
        }
      }
      if (this.shenpiDialog.oneUser.length > 0) {
        // users.push(JSON.parse(this.shenpiDialog.oneUser[1]));
        for(let i=0;i<this.shenpiDialog.oneUser.length;i++) {
          users.push(JSON.parse(this.shenpiDialog.oneUser[i]));
        }
      }

      const departs = [];
      if (this.shenpiDialog.selectedDeparts.length > 0) {
        for (let i = 0; i != this.shenpiDialog.selectedDeparts.length; i++) {
          departs.push({
            departId:
              this.departmentList[this.shenpiDialog.selectedDeparts[i]].id,
            departName:
              this.departmentList[this.shenpiDialog.selectedDeparts[i]].name,
            departLingdao:
              this.departmentList[this.shenpiDialog.selectedDeparts[i]]
                .zhijie_lingdao,
            departLingdaoName:
              this.departmentList[this.shenpiDialog.selectedDeparts[i]]
                .zhijie_lingdao_name,
          });
        }
      }

      let taskInfo = this.taskInfo.untreated.data[this.shenpiDialog.idx];
      if (this.taskInfo.cur == 1) {
        taskInfo = this.taskInfo.completed.data[this.shenpiDialog.idx];
      }
      websock
        .confirmTask({
          id: taskInfo.id,
          msg: this.shenpiDialog.msg || "",
          users,
          departs,
        })
        .then(() => {
          this.step = 0;
          this.getTaskList();
        });
    },
    closeStep(){
      this.step = 0;
    },
    // 结束流程
    endProcess() {
      console.log(this.taskInfo);
      this.$confirm('是否结束流程?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        websock.finishGongwenLiuzhuan({ id: this.relevenceId })
        .then(res => {
          console.log(res);
          if(res.code === 0) {
            this.msgSuccess("操作成功");
            this.step = 0;
            this.getTaskList();
          } else {
            this.msgSuccess("操作失败");
          }
        }).catch((err) => {
          this.msgSuccess("操作失败");
        })
      })
    },
    rejectTask() {
      let taskInfo = this.taskInfo.untreated.data[this.shenpiDialog.idx];
      if (this.taskInfo.cur == 1) {
        taskInfo = this.taskInfo.completed.data[this.shenpiDialog.idx];
      }
      this.shenpiDialog.visible = false;
      this.resetIds();
      websock
        .rejectTask({
          id: taskInfo.id,
          msg: this.shenpiDialog.msg || "",
        })
        .then(() => {
          this.step = 0;
          this.getTaskList();
        });
    },
    revertGongwen(id) {
      websock.revertGongwenLiuzhuan({ id }).then(() => {
        this.getTaskList();
      });
    },
  },
};
</script>

<style lang="scss" scoped>
@import "~@/styles/variables.scss";

.dashboard-container {
  padding: 10px;
}

.dashboard {
  &-container {
    // padding-top: 10px;
    background-color: white;
    position: relative;
  }

  &-text {
    font-size: 30px;
    line-height: 46px;
  }
}

.badge {
  margin: 10px 0px 0px 5px;
  border-radius: 1px;
}

::v-deep .el-pagination {
  text-align: right !important;
}

.tabsActive {
  background: $jianbianBg !important;
  height: 100%;
  color: #fff !important;
}

::v-deep .ant-fullcalendar-value:active {
  background: #0b847b !important;
}

.btn_active {
  background: $jianbianBg !important;
  height: 100%;
  color: #fff !important;
}

// 日历组件
::v-deep .ant-fullcalendar-header .ant-radio-group {
  display: none !important;
}

::v-deep .ant-fullcalendar-header {
  padding: 4px 17px 3px 0 !important;
}

::v-deep .ant-fullcalendar-selected-day .ant-fullcalendar-value,
.ant-fullcalendar-month-panel-selected-cell .ant-fullcalendar-value {
  background: $jianbianBg !important;
  border-color: $themeBgColor !important;
  border-radius: 50% !important;
}

::v-deep .ant-fullcalendar-today .ant-fullcalendar-value,
.ant-fullcalendar-month-panel-current-cell .ant-fullcalendar-value {
  box-shadow: 0 0 0 1px $themeBgColor inset !important;
  border-radius: 50% !important;
}

.icon-img {
  width: 40px;
  height: 40px;
  vertical-align: -15px;
  display: inline-block;
}

::v-deep .el-card__body {
  padding-top: 10px !important;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.el-radio-button__inner {
  background: $jianbianBg;
  color: #fff !important;
}

.button {
  color: #000;
}

.custom_p {
  cursor: pointer;
}

::v-deep .is-scrolling-none {
  &::-webkit-scrollbar {
    display: none;
  }
}

::v-deep .el-card__header {
  border-bottom: none;
  padding: 18px 18px 0 18px;
}

.dashboard-container {
  padding: 10px;
  width: 100%;
  height: 90vh;
  overflow: auto;
  background: #f2f2f2;

  &::-webkit-scrollbar {
    display: none;
  }

  .letf_col {
    flex-wrap: wrap;
    align-content: center;
    justify-content: space-around !important;
    padding: 5px 16px;
    height: 90%;

    .box-card1 {
      width: 100%;
      // height: 16%;
    }

    .box-card2 {
      margin: 10px 0;
      width: 100%;
      // height: 30%;
    }

    .box-card3 {
      width: 100%;
      // height: 42%;
      margin-bottom: 10px;
    }

    .top_card {
      position: relative;

      .left_img,
      .right_img {
        position: absolute;
        width: 83px;
        height: 63px;
      }

      .left_img {
        left: 10px;
        bottom: 10px;
      }

      .right_img {
        right: 100px;
        top: 0;
      }
    }

    .box-card {
      width: 100%;
      margin-bottom: 10px;
    }

    .use_ {
      display: flex;
      flex-wrap: wrap;

      .use_item {
        width: 12.5%;
        min-height: 90px;

        .icon {
          text-align: center;
        }
      }
    }

    .renwu {
      width: 152px;
      height: 40px;
      border-radius: 4px;
      overflow: hidden;
      border: 1px solid #e8e8e8;
      display: flex;
      align-items: center;
      cursor: pointer;

      div {
        height: 40px;
        line-height: 40px;
        flex: 1;
        text-align: center;
      }
    }

    .tabs {
      display: flex;

      p {
        cursor: pointer;
        padding: 6px 16px;
        border: 1px solid #ccc;
        border-radius: 2px;
        margin-right: 10px;
        position: relative;

        .el-badge {
          position: absolute;
          right: -6px;
          top: -6px;

          ::v-deep .el-badge__content {
            background-color: red !important;
          }
        }
      }
    }
  }

  .right_col {
    position: relative;
    height: 90%;

    &::-webkit-scrollbar {
      display: none;
    }

    .right_content {
      flex-wrap: wrap;
      align-content: center;
      height: 90% !important;
      background: #fff;

      .right_item1 {
        width: 100%;
      }

      .right_item {
        width: 100%;
      }

      .right_img_col {
        position: absolute;
        bottom: 0;
        right: 0;
        z-index: 0;
      }
    }
  }
}

// 自定义常用功能
::v-deep .el-dialog__body {
  padding: 0 !important;
}

.changyong {
  margin: 20px;
  background: #eff4f0;
  border-radius: 10px;
  padding: 10px;

  .changyong_title {
    font-size: 14px;
    font-weight: 500;
    color: #1d2e54;
    line-height: 16px;

    &::before {
      content: " ";
      display: inline-block;
      background: linear-gradient(90deg, #0b847b 0%, #4ea49e 100%);
      width: 3px;
      height: 12px;
      border-radius: 10px;
      margin-right: 10px;
    }
  }

  margin-bottom: 10px;

  .changyong_div {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: left;

    .changyong_item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-right: 1%;
      margin-bottom: 8px;
      padding: 8px;
      box-sizing: border-box;
      width: 24%;
      height: 60px;
      background: #ffffff;
      border-radius: 4px;
      border: 1px solid #dae5dc;
    }

    img {
      width: 40px;
      height: 40px;
    }
  }
}

.choose_item {
  width: 100%;
  height: 360px;
  overflow-y: auto;
  padding: 20px;

  .v1_item {
    .v1_name {
      font-size: 14px;
      font-weight: 500;
      color: #1d2e54;
      line-height: 16px;

      &::before {
        content: " ";
        display: inline-block;
        background: linear-gradient(90deg, #0b847b 0%, #4ea49e 100%);
        width: 3px;
        height: 12px;
        border-radius: 10px;
        margin-right: 10px;
      }
    }
  }

  .v2_div {
    padding-left: 1%;
    display: flex;
    flex-wrap: wrap;

    .div_icon {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-right: 1%;
      margin-bottom: 8px;
      padding: 8px;
      box-sizing: border-box;
      width: 24%;
      height: 60px;
      background: #ffffff;
      border-radius: 4px;
      border: 1px solid #dae5dc;

      img {
        width: 40px;
        height: 40px;
      }
    }
  }
}

.del_img {
  width: 14px !important;
  height: 14px !important;
  cursor: pointer !important;
}

::v-deep .el-dialog__header {
  padding: 10px !important;
  border-bottom: 1px solid #e4e4e4;
}

.head_title {
  display: flex;
  align-content: center;

  &:before {
    content: " ";
    display: inline-block;
    width: 4px;
    height: 17px;
    border-radius: 1px;
    margin-top: 2px;
    margin-right: 5px;
    color: #0b847b;
    background: #0b847b;
    background-color: #0b847b;
  }
}
</style>
